<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./../../templates/principalTemplate.xhtml">

            <ui:define name="content">
                    <h:form>
                        <p:panel id="panel" header="Operar consumo">
                            <p:messages id="messages2" showDetail="true" autoUpdate="true" closable="true" />
                            <h:panelGrid columns="4" cellpadding="5"  style="padding: 0 15%;">
                                <p:dataTable id="consumo" var="consumo" value="#{operarConsumoCtrl.datosTabla}" 
                                    emptyMessage="No hay consumos disponibles">
                                    <p:column headerText="Concepto">
                                        <h:outputText value="#{consumo.concepto}" />
                                    </p:column>
                                    <p:column headerText="Costo">
                                        <h:outputText value="#{consumo.costo}" />
                                    </p:column>
                                    <p:column headerText="Pagos">
                                        <h:outputText value="#{consumo.pagos}" />
                                    </p:column>
                                </p:dataTable>
                            </h:panelGrid>
                            <h:panelGrid columns="5" cellpadding="5"  style="padding: 0 15%;">
                                <h:outputLabel for="slcConsumible" value="Consumible" />
                                <p:selectOneMenu id="slcConsumible" value="#{operarConsumoCtrl.consumibleSeleccionado}">
                                    <f:selectItems value="#{operarConsumoCtrl.consumibles}" />
                                </p:selectOneMenu>
                                <p:inputText id="txtConsumible" maxlength="30" value="#{operarConsumoCtrl.montoConsumible}" />
                                <p:commandButton id="btnAgregarCon" value="Agregar" update="consumo"
                                                 actionListener="#{operarConsumoCtrl.agregarConsumibleTabla()}"/>
                                <p:message for="txtConsumible" />
                                <h:outputLabel for="slcIngreso" value="Ingreso" />
                                <p:selectOneMenu id="slcIngreso" value="#{operarConsumoCtrl.ingresoSeleccionado}">
                                    <f:selectItems value="#{operarConsumoCtrl.ingresos}" />
                                </p:selectOneMenu>
                                <p:inputText id="txtIngreso" maxlength="30" value="#{operarConsumoCtrl.montoIngreso}" />
                                <p:commandButton id="btnAgregarIng" value="Agregar" update="consumo" 
                                                 actionListener="#{operarConsumoCtrl.agregarPagoTabla()}"/>
                                <p:message for="txtIngreso" />
                            </h:panelGrid>
                        </p:panel>
                    </h:form>     
            </ui:define>

        </ui:composition>

    </body>
</html>
